package com.sicheng.lc.周赛.分类.位运算;

/**
 * @author zsc
 * @version 1.0
 * @date 2022/6/23 23:08
 */
public class 转换数字的最少位翻转次数 {
    //https://leetcode.cn/problems/minimum-bit-flips-to-convert-number/
    public int minBitFlips(int start, int goal) {
        start = start ^ goal;
        int res = 0;
        while (start > 0) {
            start = start & (start - 1);
            res++;
        }
        return res;
    }
}
